﻿using Reborn.Net.Http.Drive;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Reborn.Net.Http.Extension
{
    public static class ImgExtension
    {
        public static async Task<string> ImgUrlToBase64(this Drive.Drive webClient, string url)
        {
            string base64 = string.Empty;
            try
            {
                byte[] bytes = await webClient.GetByteAsync(url);

                base64 = Convert.ToBase64String(bytes);
            }
            catch (Exception ex)
            {

            }

            return base64;
        }
    }
}
